package com.treasure.mall.biz.repository.community;

import com.treasure.mall.biz.entity.community.CommunityArticleLikePO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/7/28
 */
public interface CommunityArticleLikeRepository extends JpaRepository<CommunityArticleLikePO, Long> {
    CommunityArticleLikePO findByArticlePO_IdAndUser_UserId(Long articleId, Long userId);


    long countByArticlePO_Id(Long authorId);

    /**
     * 我喜欢的内容
     *
     * @param userId
     * @param pageable
     * @return
     */
    Page<CommunityArticleLikePO> findByUser_UserId(Long userId, Pageable pageable);

    boolean existsByArticlePO_IdAndUser_UserId(Long articleId, Long userId);
}
